package com.pearadmin.pro.modules.feedback.rest;

import com.pearadmin.pro.modules.feedback.domain.ScrmStuFeedback;
import com.pearadmin.pro.common.aop.annotation.Log;
import com.pearadmin.pro.common.constant.ControllerConstant;
import com.pearadmin.pro.common.web.base.BaseController;
import com.pearadmin.pro.common.web.domain.Result;
import  com.pearadmin.pro.modules.feedback.domain.ScrmStuFeedback;
import  com.pearadmin.pro.modules.feedback.param.ScrmStuFeedbackRequest;
import  com.pearadmin.pro.modules.feedback.service.ScrmStuFeedbackService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;


/**
 * 学生意见反馈Controller
 *
 * @author chenJian
 * @date 2021-10-07
 */
@Api(tags = {"学生意见反馈"})
@RestController
@RequestMapping(ControllerConstant.ADMIN+"feedback/stuFeedback")
public class ScrmStuFeedbackController extends BaseController
{
    @Resource
    private ScrmStuFeedbackService scrmStuFeedbackService;

    /**
     * 查询学生意见反馈列表
     *  @param request 查询参数
     *  @return {@link Result}
     */
    @GetMapping("/page")
    @Log(title = "学生意见反馈列表")
    @ApiOperation(value = "学生意见反馈列表")
    public Result<ScrmStuFeedback> list(ScrmStuFeedbackRequest scrmStuFeedbackRequest)
    {
        return success(scrmStuFeedbackService.page(scrmStuFeedbackRequest));
    }


    /**
     * 新增保存学生意见反馈
     * @param scrmStuFeedback 查询参数
     * @return {@link Result}
     */
    @PostMapping("/save")
    @Log(title = "新增学生意见反馈")
    @ApiOperation(value = "新增学生意见反馈")
    public Result save(@RequestBody ScrmStuFeedback scrmStuFeedback)
    {
        return auto(scrmStuFeedbackService.saveOrUpdate(scrmStuFeedback));
    }

    /**
     * 查询学生意见反馈详情
     *
     * @param id 学生意见反馈ID
     * @return 学生意见反馈
     */
    @GetMapping("/selectById")
    @Log(title = "查询学生意见反馈详情")
    @ApiOperation(value = "查询学生意见反馈详情")
    public Result<ScrmStuFeedback> selectById(@RequestParam Long id)
    {
        return success(scrmStuFeedbackService.selectScrmStuFeedbackById(id));
    }



    /**
     * 修改保存学生意见反馈
     * @param scrmStuFeedback 查询参数
     * @return {@link Result}
     */
    @PutMapping("/update")
    @Log(title = "修改学生意见反馈")
    @ApiOperation(value = "修改学生意见反馈")
    public Result update(@RequestBody ScrmStuFeedback scrmStuFeedback)
    {
        return auto(scrmStuFeedbackService.saveOrUpdate(scrmStuFeedback));
    }


    /**
     * 删除保存学生意见反馈
     * @param id 查询参数
     * @return {@link Result}
     */
    @DeleteMapping("/remove")
    @Log(title = "删除学生意见反馈")
    @ApiOperation(value = "删除学生意见反馈")
    public Result remove(@RequestParam Long id)
    {
        return auto(scrmStuFeedbackService.removeById(id));
    }

    /**
    * 批量删除学生意见反馈
    * @param ids 批量删除
    * @return {@link Result}
    */
    @DeleteMapping("removeBatch")
    @Log(title = "批量删除学生意见反馈")
    @ApiOperation(value = "批量删除学生意见反馈")
    public Result removeBatch(@RequestParam List<Long> ids){
        return auto(scrmStuFeedbackService.removeByIds(ids));
    }

}
